FROM centos:7.6.1810
#安装依赖包
RUN yum update -y &&\
    yum install -y which gcc gcc-c++ gdb git make cmake wget libaio-devel flex bison ncurses-devel glibc-devel patch lsb_release readline-devel
#创建用户，openGauss基于postgresql，和postresql一样，不能在root用户下启动
RUN echo 'db123' | passwd --stdin root &&\
    groupadd dbgroup &&\
    useradd -g dbgroup omm
#切换工作目录，下面几条命令都在此目录下执行
USER omm
WORKDIR /home/omm
#下载openGauss-third_party_binarylibs解压
RUN wget https://opengauss.obs.cn-south-1.myhuaweicloud.com/3.1.0/binarylibs/openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz &&\
    tar -zxf openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz &&\
    mv openGauss-third_party_binarylibs_Centos7.6_x86_64 binarylibs
#clone源码，编译，编译后安装在/home/omm/openGauss-server/mppdb_temp_install下
RUN git clone https://gitee.com/opengauss/openGauss-server.git &&\
    cd openGauss-server &&\
    git checkout 3.1.0 &&\
    sh build.sh -m release -3rd /home/omm/binarylibs &&\
    cp -r simpleInstall/ mppdb_temp_install/
#清理垃圾文件
RUN rm openGauss-third_party_binarylibs_Centos7.6_x86_64.tar.gz